package com.taxshare.seller.controller;

import com.taxshare.mybatis.pager.PageRequest;
import com.taxshare.response.beans.Response;
import com.taxshare.seller.service.GoldenTaxPlateService;
import com.taxshare.seller.service.RemoteService;
import com.taxshare.seller.view.dto.GoldenTaxPlateDTO;
import com.taxshare.seller.view.dto.StockDetailDTO;
import com.taxshare.seller.view.vo.GoldenTaxPlateVO;
import com.taxshare.seller.view.vo.SellerInvoiceVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/remote")
@Api(tags="远程抄报")
public class RemoteController {

    @Autowired
    private GoldenTaxPlateService goldenTaxPlateService;

    @Autowired
    private RemoteService remoteService;

    @PostMapping("/report")
    @ApiOperation(value = "远程抄报", notes = "远程抄报")
    public Response report(@RequestBody SellerInvoiceVO sellerInvoiceVO) throws Exception{
        return remoteService.report(sellerInvoiceVO);
    }

    @PostMapping("/clearCard")
    @ApiOperation(value = "远程清卡", notes = "远程抄报")
    public Response clearCard(@RequestBody SellerInvoiceVO sellerInvoiceVO) throws Exception{
        return remoteService.clearCard(sellerInvoiceVO);
    }

    @PostMapping("/sync")
    @ApiOperation(value = "同步抄报信息", notes = "远程抄报")
    public Response sync(@RequestBody GoldenTaxPlateDTO goldenTaxPlateDTO) {
        return remoteService.syncReportInfo(goldenTaxPlateDTO);
    }

    @PostMapping("/queryGoldenTaxPlate")
    @ApiOperation(value = "抄报信息查询", notes = "抄报信息查询")
    public Response<GoldenTaxPlateVO> queryGoldenTaxPlate(@RequestBody PageRequest<GoldenTaxPlateDTO> query) {
        return goldenTaxPlateService.queryGoldenTaxPlate(query);
    }
}